﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Controls_Common_ctrLanguage : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            this.SetData(); 
        }
    }

    private void SetData()
    { 
        string sSession = ConvertData.ConvertToString(  Session[Config.SESSION_USEREMAIL]);
        if (sSession !="")
        {
            lblUser.Visible = true;
            btnLogout.Visible = true;
            lblUser.Text = "Welcome" + " " + ConvertData.ConvertToString(Session[Config.SESSION_USERNAME]); 
            
        }
        else
        {
            lblUser.Visible = false;
            btnLogout.Visible = false; 
        }
    }
    protected void btnVN_Click(object sender, ImageClickEventArgs e)
    {
        Session["CurrentLanguage"] = "1";
        Response.Redirect(Request.RawUrl);
    }
    protected void btnEN_Click(object sender, ImageClickEventArgs e)
    {
        Session["CurrentLanguage"] = "2";
        Response.Redirect(Request.RawUrl);
    }
    protected void btnLogout_Click(object sender, ImageClickEventArgs e)
    {
        string sHomePage = "~/" + Pages.FrontEnds.HOME;
        Session.Clear();
        Response.Redirect(sHomePage);
    }
}
